#ifndef PROXY_MGR_H
#define PROXY_MGR_H

#include <list>
#include <hash_map>
#include "singleton.h"
#include "typedef.h"



class CProxy;
class CSessionEventHandler;
class CProxyMgr : public CSingleton<CProxyMgr>
{
    friend class CSingleton<CProxy>;
    //typedef std::list<uint16> TIdContainer;
    typedef std::hash_map<uint64, CProxy *> TProxyContainer;
public:
    //default constructor
    CProxyMgr(void);

    // default destructor
    ~CProxyMgr(void);

    // create the proxy
    CProxy * CreateProxy(CSessionEventHandler * pCliSessionEventHandler);

    // destroy the proxy
    void DestroyProxy(CProxy * pProxy);

    //CProxy * Find(uint32 nId);
    CProxy * Find(uint64 nSocketPair);

    CProxy * Find(uint32 nIPAddr, uint16 port);

    uint16 GetProxyCount();

    // get an inactive id
    //uint16 _FetchID();
protected:
    //TIdContainer m_InactiveIds;
    TProxyContainer m_Proxies;

};

#endif // endif of PROXY_MGR_H
